load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")

package(default_visibility = ["//visibility:public"])

filegroup(
    name = "sources",
    srcs = glob(["**"]),
)

DEPENDENCIES = [
    # Keep sorted.
    "//rs/crypto/sha2",
    "//rs/types/types",
    "@crate_index//:rand",
    "@crate_index//:rand_chacha",
    "@crate_index//:strum",
]

DEV_DEPENDENCIES = [
    # Keep sorted.
    "//rs/types/types_test_utils",
]

rust_library(
    name = "prng",
    srcs = glob(["src/**/*.rs"]),
    crate_name = "ic_crypto_prng",
    proc_macro_deps = [
        # Keep sorted.
        "@crate_index//:strum_macros",
    ],
    version = "0.1.0",
    deps = DEPENDENCIES,
)

rust_test(
    name = "prng_unit_tests",
    crate = ":prng",
    deps = DEPENDENCIES + DEV_DEPENDENCIES,
)

rust_test_suite(
    name = "test_suite",
    srcs = glob(["tests/**"]),
    deps = [":prng"] + DEPENDENCIES + DEV_DEPENDENCIES,
)
